	YAHOO.widget.Chart.SWFURL = "/js/yui/build/charts/assets/charts.swf";

	var oDSGrupo = new YAHOO.util.XHRDataSource('/contarc/porgrupo');
	oDSGrupo.connMethodPost = true;
	oDSGrupo.responseType = YAHOO.util.XHRDataSource.TYPE_JSARRAY;
	oDSGrupo.responseSchema = {
		fields : [ 'descricao', 'valor' ]
	};
	//oDSGrupo.sendRequest();

	// --- chart

	var mychart = new YAHOO.widget.PieChart("chart", oDSGrupo, {
		dataField :"valor",
		categoryField :"descricao",
		style : {
			padding :20,
			legend : {
				display :"right",
				padding :10,
				spacing :5,
				font : {
					family :"Arial",
					size :13
				}
			}
		},
		// only needed for flash player express install
		expressInstall :"assets/expressinstall.swf"
	});

function meuteste(e) {
	YAHOO.widget.Chart.SWFURL = "/js/yui/build/charts/assets/charts.swf";
	var options = {
		method :'get',
		parameters :'grupo_id=',
		nome :'/id/',
		onSuccess : function(transport) {
			//alert(transport.responseText);
			var a = eval(transport.responseText);
			var oDSGrupo = new YAHOO.util.DataSource(a);
			oDSGrupo.connMethodPost = true;
			oDSGrupo.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
			oDSGrupo.responseSchema = {
				fields : [ 'descricao', 'valor' ]
			};

			// --- chart

		var mychart = new YAHOO.widget.PieChart("chart", oDSGrupo, {
			dataField :"valor",
			categoryField :"descricao",
			style : {
				padding :20,
				legend : {
					display :"right",
					padding :10,
					spacing :5,
					font : {
						family :"Arial",
						size :13
					}
				}
			},
			// only needed for flash player express install
			expressInstall :"assets/expressinstall.swf"
		});
		var columns =
			[
				{ key: "descricao",    sortable: true, resizeable: true },
				{ key: "valor", formatter: "currency", sortable: true, resizeable: true },
			];
		var mytable = new YAHOO.widget.DataTable( "datatable", columns, oDSGrupo,
				{ sortedBy: { key: "descricao", dir: "asc" }
			});
	},
	onFailure : function(transport) {
		alert('Erro');
	}
	}
	new Ajax.Request('/contarc/index', options);

	//alert('passei');
}
Event.observe(window,"load",meuteste);

$('teste').observe('click', meuteste);
